package com.ndp.fb.fbagent.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ndp.fb.fbagent.service.AdGroupStatFBService;
import com.ndp.fb.model.fbagent.param.stats.InsightsParam;
import com.restfb.Parameter;

/**
 * Created by Jacky on 2015/2/26.
 */
@Service
public class AdGroupStatFBServiceImpl extends AbstractFBagentService implements AdGroupStatFBService {

    @Override
    public void postInsightsByFbAccountId(InsightsParam param) {
        Parameter[] parameters = this.adapterArray(param);
        String uri = "/act_" + param.getFbAccountId() + "/insights";
        makePostRequest(uri, param.getAccessToken(), parameters);
    }

    @Override
    public void getAsynchronousJobByJobId(InsightsParam param) {
        Parameter[] parameters = this.adapterArray(param);
        String uri = "/" + param.getJobId();
        makeGetRequest(uri, param.getAccessToken(), parameters);
    }

    @Override
    public void getInsightsByJobId(InsightsParam param) {
        Parameter[] parameters = this.adapterArray(param);
        String uri = "/" + param.getJobId() + "/insights";
        makeGetRequest(uri, param.getAccessToken(), parameters);
    }
}
